/*
 * @FilePath: index.ts
 * @@author: wjj
 * @Date: 2024-10-10 11:30:27
 * @@Description: new js file
 */
//统一管理咱们项目用户相关的接口
import request from '@/utils/request'
import type {
  loginFormData,
  loginResponseData,
  userInfoReponseData,
} from './type'
enum API {
  LOGIN_URL = '/admin/acl/index/login',
  // LOGIN_URL = '/user/login',
  USERINFO_URL = '/admin/acl/index/info',
  // USERINFO_URL = '/user/info',
  // LOGOUT_URL = '/admin/acl/index/logout',
  LOGOUT_URL = '/nimi/auth/user/logout',
}

// console.log('666666', localurl)
//登录接口
export const reqLogin = (data: loginFormData) =>
  // request.post<any, loginResponseData>(API.LOGIN_URL, data)
  request.post<any, loginResponseData>('/nimi/auth/user/login/', data)
// .then((data) => {
//   console.log('+++', data)
// })
// .catch((error) => {
//   console.log('----', error)
// })

//获取用户信息
export const reqUserInfo = () =>
  // request.get<any, userInfoReponseData>(API.USERINFO_URL)
  request.get<any, userInfoReponseData>('/nimi/auth/user/info')
//退出登录
export const reqLogout = () => request.get<any, any>(API.LOGOUT_URL)
